/*******************************************************************************
EntityManager.h

	Creates an entity based on the given EntityResource.
*******************************************************************************/

#pragma once

#include <map>						// The container of choice
#include "EntityResource.h"			// The data used to create an entity
#include "Entity.h"					// The entity base class
#include "ControllerManager.h"		// The controller manager

#include "PaddleEntity.h"			// The PaddleEntity derived class
#include "PaddleControllerPlayer.h"	// The players paddle controller
#include "PaddleControllerCpu.h"

#include "LevelEntity.h"			// LevelEntity
#include "BallEntity.h"				// BallEntity

// Make our own type, based on int
typedef int EntityID;

class EntityManager
{
public:
	// A destructor to clean up memory
	~EntityManager(void);
	// Retrieves the instance of the entity manager
	static EntityManager* GetManager(void);
	// Creates an Entity from an EntityResource and returns an ID to the Entity
	EntityID CreateEntity(EntityResource& entityData);
	// Gets a reference to an entity at the given Entity ID
	Entity* GetEntity(EntityID id);
	// Updates the entities
	void Update(float fElapsed);
	// Returns the number of active entities
	std::map<EntityID, Entity*>& GetEntityList(void);
protected:
	// A private constructor so that no one can create an EntityResource
	EntityManager(void) {}
	// The only instance of EntityManager
	static EntityManager* m_pInstance;
	// Stores our entity pointers so we can reference and update them
	std::map<EntityID, Entity*> m_entityList;
}; // EntityManager